var xmlhttp;var aveg="Not yet voted.";
if(window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
} else if(window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var shows = 0;
var rid;
var lc;
function load(rate,rid){
lc=rid;
if (shows){
if(rid==lc){
return;
}
};
var qs = 'http://www.ratingcode.com/script.php?id='+rid+'&rate='+rate;
xmlhttp.open("POST", qs);
xmlhttp.onreadystatechange = handleResponse;
xmlhttp.send(null);
}
function notext (raid)
{
lc=raid;
if (shows){
if(raid==lc){
return;
}
};
var cy;
var poy;
cy = raid;
poy = document.getElementById(cy);
poy.innerHTML=aveg;
//poy.innerHTML='';
}
function show(star_img,rnid,style) 
{
if (shows){
if(rnid==lc){
return;
}
};
var i;
var image;
var ny;
var cy;
var poy;
cy = rnid;
poy = document.getElementById(cy);
for (i=1; i<=star_img; i++) {
image =  'qw'+rnid + i;
ny = document.getElementById(image);
ny.src="http://imageshack.us/photo/my-images/812/lippie.gif";
if(i=='1'){
poy.innerHTML='Poor';
}
else if(i=='2'){
poy.innerHTML='Fair';
}
else if(i=='3'){
poy.innerHTML='Good';
}
else if(i=='4'){
poy.innerHTML='Very Good';
}
else if(i=='5'){
poy.innerHTML='Excellent';
}
}
}
function noshow(star_img,rnid,style)
{
    if (shows){
			if(rnid==lc){
		return;
			}
			};
    var i;
    var image;
    var ny;

    for (i=1; i<=5; i++) {
    image = 'qw'+rnid + i;
    ny = document.getElementById(image);
	ny.src="http://imageshack.us/photo/my-images/14/lippieempty.gif";
    }
	for (i=1; i<=star_img; i++) {
        image = 'qw'+rnid + i;
        ny = document.getElementById(image);
		ny.src="http://imageshack.us/photo/my-images/14/lippieempty.gif";
    }
	//check(rnid,style);
}function check(doc,rnid,style){for (var i=1; i<=5; i++) {var image; var ny;image = 'qw'+rnid + i;ny = document.getElementById(image);if(i<=doc){ny.src="http://imageshack.us/photo/my-images/812/lippie.gif";}else{ny.src="http://imageshack.us/photo/my-images/14/lippieempty.gif";}} }function mark(star_img,rid,style)
{
var cy;
var poy;
cy =  rid;
poy = document.getElementById(cy);
    if (shows){
	if(rid==lc){
	return;
	}
	};
    show(star_img,rid,style);
    shows = 1;
	lc=rid;
    //var n = document.getElementById('n'+rid);
    var qs = 'http://www.ratingcode.com/script.php?rate=' + star_img + '&id='+rid+'&st='+style;
	xmlhttp.open("POST", qs);
	xmlhttp.onreadystatechange = handleResponse1;
    poy.innerHTML = "Thank you.";
	xmlhttp.send(null);
}
function handleResponse() {
  if(xmlhttp.readyState == 4){
	var response = xmlhttp.responseText;
		document.getElementById(lc).innerHTML = response;
  }}function waiting(){
document.getElementById(lc).innerHTML = "Thank you.";
}
	function handleResponse1() {
  if(xmlhttp.readyState == 4){
	var response = xmlhttp.responseText;
	setTimeout(function waiting(){document.getElementById(lc).innerHTML = response;},1500);
	
  }}
function showform(raid,style){var doc="0";var aveg="Not yet voted.";document.write("<Table width=115 border=0 cellpadding=0 cellspacing=0><TR><TD width=115 colspan=2 style='FONT-FAMILY: Verdana, Arial;font-size:12px;' align='center'><span id=n"+raid+"></span></TD></TR><TR><TD width=115 style='padding:0px;' align='center'><span id=povc>");
var i;
for (i=1; i<=5; i++) {if(i<=doc){document.write("<img src='http://imageshack.us/photo/my-images/812/lippie.gif" id=qw"+raid+i+"  onmouseover='noshow("+i+","+raid+","+style+");show("+i+","+raid+","+style+")' onmouseout='noshow("+i+","+raid+","+style+");notext("+raid+");check("+doc+","+raid+","+style+");' onclick='mark("+i+","+raid+","+style+")'>");}else{document.write("<img src='http://imageshack.us/photo/my-images/14/lippieempty.gif' id=qw"+raid+i+"  onmouseover='noshow("+i+","+raid+","+style+");show("+i+","+raid+","+style+")' onmouseout='noshow("+i+","+raid+","+style+");notext("+raid+");check("+doc+","+raid+","+style+");' onclick='mark("+i+","+raid+","+style+")'>");}
}
document.write("</span></TD></TR><TR><td width=115 align='center' style='font-size:10px;padding-left:2px;FONT-FAMILY: Verdana, Arial;'><span id="+raid+" style='FONT-FAMILY: Verdana, Arial;font-size:10px;'>"+aveg+"</span></TD></TR></Table>");
}
